package com.share.iostream;

import java.io.*;
/**
 * 拷贝文件内容到其他文件
 * @author Johnny Tam
 *
 */
public class TestFileOutputStream {
  public static void main(String[] args) {
	  int b = 0;
	  FileInputStream in = null;
	  FileOutputStream out = null;
	  String str = "E:\\Coursera-Java\\Eclipse\\workspace\\chapter18-IO\\src\\com\\share\\iostream\\TestFileInputStream.java";
	  try {
			in = new FileInputStream("E:\\Coursera-Java\\Eclipse\\workspace\\chapter18-IO\\src\\com\\share\\iostream\\TestFileInputStream.java");
		    out = new FileOutputStream("E:\\Coursera-Java\\Eclipse\\workspace\\chapter18-IO\\src\\com\\share\\iostream\\Res_TestFileInputStream.java");
//	    while((b=in.read())!=-1){
//	      out.write(b);
//	    }		   
	    in.close(); 
	    out.close();
	  } catch (FileNotFoundException e2) {
	    System.out.println("找不到指定文件"); System.exit(-1);
	  } catch (IOException e1) {
	    System.out.println("文件复制错误"); System.exit(-1);
	  }
	  System.out.println("文件已复制");
  }
}
